package com.quanyan.pay.enums;

import com.quanyan.api.enums.AssetsType;

/**
 * @author songzj
 * @date 16/6/7-17:15
 */
public enum TradeTypeEnum {

    TRADE_TYPE_WEICHAT_JSAPI(PayWayEnum.PAY_WAY_WEICHATH5.getPayId(), "JSAPI", "微信公众号"),
    TRADE_TYPE_WEICHAT_APP(PayWayEnum.PAY_WAY_WEICHAT.getPayId(), "APP", "微信App支付"),

    TRADE_TYPE_ALIPAY_SCAN(PayWayEnum.PAY_WAY_ALIPAY_SCAN.getPayId(), "ALISCAN", "支付宝条码支付"),
    TRADE_TYPE_WEICHAT_SCAN(PayWayEnum.PAY_WAY_WEICHAT_SCAN.getPayId(), "WXSCAN", "微信条码支付"),

    TRADE_TYPE_WEICHAT_NATIVE(PayWayEnum.PAY_WAY_WEICHAT_SCAN_CODE.getPayId(), "NATIVE", "原生扫码支付"),
    TRADE_TYPE_WEICHAT_MICROPAY(PayWayEnum.PAY_WAY_WEICHAT_SCAN.getPayId(), "MICROPAY", "微信刷卡支付"),

    TRADE_TYPE_ALIPAY_APP(PayWayEnum.PAY_WAY_ALIPAY.getPayId(), "ALIPAYAPP", "支付宝APP支付"),
    TRADE_TYPE_ALIPAY_H5(PayWayEnum.PAY_WAY_ALIPAY_H5.getPayId(), "ALIPAYH5", "支付宝H5支付"),
    TRADE_TYPE_ALIPAY_SCAN_CODE(PayWayEnum.PAY_WAY_ALIPAY_SCAN_CODE.getPayId(), "ALIPAYH5", "支付宝扫码支付"),
    TRADE_TYPE_FOR_FREE(PayWayEnum.PAY_WAY_FOR_FREE.getPayId(), "FREE", "支付金额为零"),

    TRADE_TYPE_UNION_PAY(PayWayEnum.PAY_WAY_UNION_PAY.getPayId(), "UNIONPAY", "银联支付"),
    TRADE_TYPE_UNION_PAY_POS(PayWayEnum.PAY_WAY_UNION_PAY_POS.getPayId(), "UNIONPAYPOS", "银联POS支付"),

    ;

    public static TradeTypeEnum getByPayId(Integer payId) {
        if(null==payId){
            return null;
        }
        for(TradeTypeEnum tmp: TradeTypeEnum.values()) {
            if(tmp.payId.intValue() == payId.intValue()) {
                return tmp;
            }
        }
        return null;
    }

    TradeTypeEnum(Integer payId, String payType, String payDesc) {
        this.payId = payId;
        this.payType = payType;
        this.payDesc = payDesc;
    }

    private Integer payId;

    private String payType;

    private String payDesc;

    public Integer getPayId() {
        return payId;
    }

    public String getPayType() {
        return payType;
    }

    public String getPayDesc() {
        return payDesc;
    }
}
